package com.lx.patterns.singleton.demo5;

import java.io.Serializable;

/**
 * @ClassName Singleton
 * @Description: //懒汉式-静态内部类
 * @Author: 落雪
 * @CreateDate: 2025/1/12 16:56
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/1/12 16:56
 * @UpdateRemark:
 * @Version: 1.0
 */

public class Singleton implements Serializable {



    private Singleton(){};


    private  static class  SingletonHolder{

        private static final Singleton instance = new Singleton();

    }



    public static  Singleton getInstance(){

        return SingletonHolder.instance;
    }

    public Object readResolve(){
        return Singleton.getInstance();
    }
}